package com.tueye.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.tueye.base.util.BaseDao;
import com.tueye.base.util.IBaseHbnDao;
import com.tueye.base.util.Page;
import com.tueye.dao.IAdminInfoDao;
import com.tueye.entity.Admin;
/**
 * 
 * @author hanxiaowei
 *
 */
@Scope("prototype")
@Component("adminInfoDao")
public class AdminInfoDaoImpl extends BaseDao implements IAdminInfoDao{
	
	@Autowired
	@Qualifier("baseHbnDao")
	private IBaseHbnDao  baseHbnDao;

	@Override
	public Page pagedQueryByHQL(String hql, int pageNo, int pageSize,
			Object... values) {
		return baseHbnDao.pagedQueryByHQL(hql, pageNo, pageSize, values);
	}

	@Override
	public void addAdmin(Admin admin){
		baseHbnDao.saveOrUpdate(admin);
		
	}

	@Override
	public void delAdmin(String id) {
		Admin admin =  (Admin) baseHbnDao.findById(Admin.class, id);
		baseHbnDao.delete(admin);
	}

	@Override
	public Admin getAdminById(String id) {
		return (Admin) baseHbnDao.findById(Admin.class, id);
	}

}
